<template>
  <div>
    <el-carousel
      indicator-position="outside"
      class="index_swiper"
      height="500px"
    >
      <!-- 轮播图 -->
      <el-carousel-item v-for="item in slideShowList" :key="item">
        <el-image :src="item.appAdvertiseUrl" style="width: 100% ;height: 100%;"></el-image>
      </el-carousel-item>
    </el-carousel>
    <div class="app-header-sticky" >
      <div class="container">
        <Tabs></Tabs>
      </div>
    </div>
    <router-view></router-view>
  </div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
  name: "Index",
});
</script>
<script lang="ts" setup>
import Tabs from "./components/Tabs/index.vue";
import { storeToRefs } from "pinia";
import useIdenxState from "./hooks";
const idenxState = useIdenxState();
const { slideShowList } = storeToRefs(idenxState);
// const y = ref(0);
// const topY = ref(0);
// const update = () => {
//   y.value = document.documentElement.scrollTop;
//   console.log(isTop.value);
// };
// onMounted(() => {
//   window.addEventListener("scroll", update);
//   topY.value = (document.querySelector(".app-header-sticky") as any).offsetTop;
// });
// onUnmounted(() => {
//   window.removeEventListener("scroll", update);
// });
// const isTop = computed(() => {
//   return !(topY.value >= y.value);
// });
</script>
<style scoped>
.index_swiper {
  margin: 20px 0;
  border-radius: 5px;
}
.el-carousel__item h3 {
  display: flex;
  color: #475669;
  opacity: 0.75;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
.activeTop {
  width: 95%;
  position: fixed;
  top: 0;
  z-index: 999;
  background-color: rgb(236, 235, 235);
}
.app-header-sticky{
  position: sticky;
  top: 0;
  z-index: 999;
  width: 100%;
  background-color: #f5f7f9;
}
</style>
